export const userRules = {
  userName: [
    { trigger: 'blur', required: true, message: '请输入用户名' },
    { trigger: 'blur', min: 2, max: 20, message: '用户名长度在 2 到 20 个字符' }
  ],
  nickName: [{ trigger: 'blur', required: true, message: '请输入用户昵称' }],
  password: [
    { trigger: 'blur', required: true, message: '请输入密码' },
    { trigger: 'blur', min: 6, max: 20, message: '密码长度在 6 到 20 个字符' },
    { pattern: /^[a-zA-Z0-9_-]{6,20}$/, message: '原始密码必须包含字母和数字' }
  ],
  phoneNumber: [
    { trigger: 'blur', required: true, message: '请输入手机号' },
    { trigger: 'blur', pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号' }
  ],
  email: [
    { trigger: 'blur', required: false, message: '请输入邮箱' },
    { trigger: 'blur', type: 'email', message: '请输入正确的邮箱地址' }
  ],
  remark: [{ trigger: 'blur', max: 200, message: '备注最大长度 200 个字符' }]
};

export const roleRules = {
  roleName: [
    { trigger: 'blur', required: true, message: '请输入角色名称' },
    { trigger: 'blur', min: 2, max: 20, message: '长度在 2 到 20 个字符' }
  ],
  roleKey: [
    { trigger: 'blur', required: true, message: '请输入权限标识' },
    { trigger: 'blur', min: 2, max: 20, message: '长度在 2 到 20 个字符' }
  ],
  remark: [{ trigger: 'blur', max: 200, message: '备注最大长度 200 个字符' }]
};

export const menuRules = {
  parentId: [{ required: true, message: '请选择上级菜单' }],
  menuName: [
    { trigger: 'blur', required: true, message: '请输入菜单名称' },
    { trigger: 'blur', min: 2, max: 20, message: '菜单名称长度在 2 到 20 个字符' }
  ],
  buttonName: [
    { trigger: 'blur', required: true, message: '请输入按钮名称' },
    { trigger: 'blur', min: 2, max: 20, message: '按钮名称长度在 2 到 20 个字符' }
  ],
  menuPath: [
    { trigger: 'blur', required: true, message: '请输入菜单路径' },
    { trigger: 'blur', min: 2, max: 50, message: '长度在 2 到 50 个字符' },
    { trigger: 'blur', pattern: /^\/+[a-zA-Z0-9_]+$/, message: '以斜杠开头，包含字母、数字和下划线' }
  ],
  component: [
    { trigger: 'blur', required: true, message: '请输入组件路径' },
    { trigger: 'blur', min: 2, max: 50, message: '长度在 2 到 50 个字符' },
    { trigger: 'blur', pattern: /^\/+[a-zA-Z0-9_/]+$/, message: '以斜杠开头，包含字母、数字、下划线和斜杆' }
  ],
  menuCode: [
    { trigger: 'blur', required: true, message: '请输入权限标识' },
    { trigger: 'blur', min: 2, max: 50, message: '长度在 2 到 50 个字符' },
    { trigger: 'blur', pattern: /^[a-zA-Z][a-zA-Z0-9_:]+$/, message: '以字母开头，包含字母、数字、下划线和冒号' }
  ],
  query: [
    { trigger: 'blur', required: false, message: '请输入路由参数' },
    { trigger: 'blur', min: 2, max: 50, message: '长度在 2 到 50 个字符' },
    { trigger: 'blur', pattern: /^[a-zA-Z]+(,[a-zA-Z]+)*$/, message: '只能字母，多个以逗号分隔' }
  ]
};

export const dictRules = {
  dictName: [
    { trigger: 'blur', required: true, message: '请输入字典名称' },
    { trigger: 'blur', min: 2, max: 20, message: '长度在 2 到 20 个字符' }
  ],
  dictType: [
    { trigger: 'blur', required: true, message: '请选择字典类型' },
    { trigger: 'blur', min: 2, max: 20, message: '长度在 2 到 20 个字符' },
    { trigger: 'blur', pattern: /^[a-zA-Z]+[a-zA-Z_]*[a-zA-Z]$/, message: '以字母开头和结尾，只包含字母和下划线' }
  ],
  dictCode: [
    { trigger: 'blur', required: true, message: '请输入字典编码' },
    { trigger: 'blur', min: 2, max: 20, message: '长度在 2 到 20 个字符' }
  ],
  dataLabel: [
    { trigger: 'blur', required: true, message: '请输入字典标签' },
    { trigger: 'blur', min: 2, max: 20, message: '长度在 2 到 20 个字符' }
  ],
  dataValue: [
    { trigger: 'blur', required: true, message: '请输入字典值' },
    { trigger: 'blur', max: 20, message: '最大长度 20 个字符' },
    { trigger: 'blur', pattern: /^[a-zA-Z0-9]+$/, message: '只包括数字和字母' }
  ],
  remark: [{ trigger: 'blur', max: 200, message: '备注最大长度 200 个字符' }]
};

export const noticeRules = {
  noticeTitle: [
    { trigger: 'blur', required: true, message: '请输入公告标题' },
    { trigger: 'blur', min: 2, max: 50, message: '长度在 2 到 50 个字符' }
  ],
  noticeContent: [{ trigger: 'blur', required: true, message: '请输入公告内容' }]
};
